//
//  Config.swift
//  zhengwutong
//
//  Created by wangshuguan on 16/8/17.
//  Copyright © 2016年 wangshuguan. All rights reserved.
//

import UIKit

struct Config {
    struct App {
        static let displayName = Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String ?? ""
        static let version:String = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
        static let buildVersion:String = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
        static let appId:String = Bundle.main.infoDictionary?["CFBundleIdentifier"] as? String ?? ""
    }
    struct device{
        static let platform:String = {
            var size = 0
            sysctlbyname("hw.machine", nil, &size, nil, 0)
            var machine = [CChar](repeating: 0,  count: size)
            sysctlbyname("hw.machine", &machine, &size, nil, 0)
            return String(cString: machine)
        }()
        static let idfv:String = (UIDevice.current.identifierForVendor?.uuidString)!
        static let OS:String = {
            let device = UIDevice.current
            return device.systemName + device.systemVersion}()
    }
    struct host{
        static let hostTag = "server"
        static let hostname = "115.28.80.244"
        static let hostnameAndPort = "\(hostname):8000"
    }
    struct supportKey {
        static let channel = "develop"
    }
    
    struct systemSetting {
        static let isProxy = false
        static let launchNetworkCount = 4
    }
}
extension NSNotification.Name {
    static let noPermission = NSNotification.Name(rawValue: "noPermissionNotification")
    static let userLogout = NSNotification.Name(rawValue: "userLogoutNotification")
    static let playNextCommand = NSNotification.Name(rawValue: "playNextCommandNotification")
    static let togglePlayPauseCommand = NSNotification.Name(rawValue: "togglePlayPauseCommandNotification")
    static let cleanData = NSNotification.Name(rawValue: "cleanDataNotification")
    static let newChapterDownloaded = NSNotification.Name(rawValue: "newChapterDownloadedNotification")
}
extension String{
    var withHost : String {
        get{
            return "http://" + Config.host.hostnameAndPort + self
        }
    }
    var withApi : String {
        get{
            return "http://" + Config.host.hostnameAndPort + self
        }
    }
}
extension UIColor{
    static let `default` = UIColor(132,18,28)
}
